/*
 * Copyright (C) 2011 PickleMan <admin.aegamesi@gmail.com>
 * Copyright (C) 2011 IsmAvatar <IsmAvatar@gmail.com>
 * 
 * This file is part of Jeie.
 * Jeie is free software and comes with ABSOLUTELY NO WARRANTY.
 * See LICENSE for details.
 */

package org.jeie.gui.panels;

import java.awt.Dimension;
import java.awt.Rectangle;

import javax.swing.ButtonGroup;
import javax.swing.JPanel;
import javax.swing.JToggleButton;

import org.jeie.util.Util;

public class FillPanel extends JPanel
	{
	private static final long serialVersionUID = 939817877255023658L;

	private JToggleButton rect1;
	private JToggleButton rect2;
	private JToggleButton rect3;
	private ButtonGroup rectGroup;

	public FillPanel()
		{
		setPreferredSize(new Dimension(48,72));
		setLayout(null);

		rect1 = new JToggleButton(Util.getIconForKey("FillPanel.RECT1")); //$NON-NLS-1$
		rect2 = new JToggleButton(Util.getIconForKey("FillPanel.RECT2")); //$NON-NLS-1$
		rect3 = new JToggleButton(Util.getIconForKey("FillPanel.RECT3")); //$NON-NLS-1$

		rect1.setBounds(new Rectangle(0,0,48,24));
		rect2.setBounds(new Rectangle(0,24,48,24));
		rect3.setBounds(new Rectangle(0,48,48,24));

		rectGroup = new ButtonGroup();
		rectGroup.add(rect1);
		rectGroup.add(rect2);
		rectGroup.add(rect3);

		add(rect1);
		add(rect2);
		add(rect3);

		rect1.setSelected(true);
		}

	public Type getType()
		{
		if (rect1.isSelected()) return Type.OUTLINE;
		if (rect2.isSelected()) return Type.FILL;
		if (rect3.isSelected()) return Type.FILL_OUTLINE;
		return null;
		}

	public enum Type
		{
		OUTLINE,FILL,FILL_OUTLINE;
		}
	}
